/*  1:   */ package org.intellij.plugins.relaxNG.model.descriptors;
/*  2:   */ 
/*  3:   */

import org.kohsuke.rngom.digested.DAttributePattern;
import org.kohsuke.rngom.digested.DElementPattern;
import org.kohsuke.rngom.digested.DPattern;
import org.kohsuke.rngom.digested.DRefPattern;

import java.util.ArrayList;
import java.util.List;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */ 
/* 10:   */ class ChildElementFinder
/* 11:   */   extends RecursionSaveWalker
/* 12:   */ {
/* 13:28 */   private final List<DElementPattern> c = new ArrayList();
/* 14:   */   private final int d;
/* 15:   */   private int e;
/* 16:   */   
/* 17:   */   private ChildElementFinder(int paramInt)
/* 18:   */   {
/* 19:34 */     this.d = paramInt;
/* 20:   */   }
/* 21:   */   
/* 22:   */   public Void onRef(DRefPattern paramDRefPattern)
/* 23:   */   {
/* 24:38 */     if ((this.e < this.d) || (this.d == -1)) {
/* 25:39 */       return super.onRef(paramDRefPattern);
/* 26:   */     }
/* 27:41 */     return null;
/* 28:   */   }
/* 29:   */   
/* 30:   */   public Void onElement(DElementPattern paramDElementPattern)
/* 31:   */   {
/* 32:45 */     this.e += 1;
/* 33:   */     try
/* 34:   */     {
/* 35:   */       Void localVoid;
/* 36:47 */       if ((this.e == this.d) || (this.d == -1))
/* 37:   */       {
/* 38:48 */         this.c.add(paramDElementPattern);
/* 39:49 */         return this.d != -1 ? null : super.onElement(paramDElementPattern);
/* 40:   */       }
/* 41:51 */       return super.onElement(paramDElementPattern);
/* 42:   */     }
/* 43:   */     finally
/* 44:   */     {
/* 45:54 */       this.e -= 1;
/* 46:   */     }
/* 47:   */   }
/* 48:   */   
/* 49:   */   public Void onAttribute(DAttributePattern paramDAttributePattern)
/* 50:   */   {
/* 51:60 */     return null;
/* 52:   */   }
/* 53:   */   
/* 54:   */   static List<DElementPattern> find(int paramInt, DPattern paramDPattern)
/* 55:   */   {
/* 56:64 */     ChildElementFinder localChildElementFinder = new ChildElementFinder(paramInt);
/* 57:65 */     localChildElementFinder.doAccept(new DPattern[] { paramDPattern });
/* 58:66 */     return localChildElementFinder.c;
/* 59:   */   }
/* 60:   */   
/* 61:   */   static List<DElementPattern> find(DPattern paramDPattern)
/* 62:   */   {
/* 63:70 */     return find(1, paramDPattern);
/* 64:   */   }
/* 65:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.plugins.relaxNG.model.descriptors.ChildElementFinder

 * JD-Core Version:    0.7.0.1

 */